{% extends 'base.html' %}

{% block title %}
    <title>{{ title }}</title>
{% endblock %}

{% block topbar %}
    <h3 class="theme">{{ title }}</h3>
    <ul class="nav nav-pills add-link">
        <li role="presentation"><a href="/addauthor/">添加作者</a></li>
        <li class="sep">|</li>
        <li role="presentation"><a href="/addpublish/">添加出版社</a></li>
        <li class="sep">|</li>
        <li role="presentation"><a href="/addbook/">添加图书</a></li>
    </ul>
{% endblock %}

{% block main %}

{% endblock %}

{% block paginator %}
    <nav aria-label="Page navigation">
        <ul class="pagination">
{#              上一页#}
        {% if current_page.has_previous %}
            <li>
                <a class="ends" href="?page={{ current_page.previous_page_number }}" aria-label="Previous">
                    <span aria-hidden="true">上一页</span>
                </a>
            </li>
        {% else %}
{#            如果没有上一页了，就把标签禁止，且没有连接#}
            <li class="disabled">
                <a class="ends" href="" aria-label="Previous">
                    <span aria-hidden="true">上一页</span>
                </a>
            </li>
        {% endif %}
{#              中间的页码#}
            {% for page in page_range %}
{#                如果循环的页码等于当前的页码，就添加active#}
                {% if current_page_num == page%}
                    <li class="active"><a href="?page={{ page }}">{{ page }}</a></li>
                {% else %}
                    <li><a href="?page={{ page }}">{{ page }}</a></li>
                {% endif %}
            {% endfor %}

{#              下一页#}
        {% if current_page.has_next %}
            <li>
                <a class="ends" href="?page={{ current_page.next_page_number }}" aria-label="Next">
                    <span aria-hidden="true">下一页</span>
                </a>
            </li>
        {% else %}
{#            如果没有下一页了，就把标签禁止，且没有连接#}
            <li class="disabled">
                <a class="ends" href="" aria-label="Next">
                    <span aria-hidden="true">下一页</span>
                </a>
            </li>
        {% endif %}

  </ul>
</nav>
{% endblock %}

{% block backIdenx %}
    <li class="sep">|</li>
    <li role="presentation"><a href="/index/">返回首页</a></li>
{% endblock %}